package com.lianbang.staff.module.user

import android.app.Activity
import android.content.Context
import android.content.Intent
import android.view.View
import cn.ubest.mvvmcore.base.BaseActivity
import cn.ubest.mvvmcore.utils.DoubleClickHelper
import cn.ubest.mvvmcore.utils.LogUtils
import com.lianbang.staff.R
import com.lianbang.staff.databinding.ActivityAccountSafeBinding
import com.lianbang.staff.util.LoginUtils
import com.lianbang.staff.vm.MainVM
import kotlinx.android.synthetic.main.activity_account_safe.*

/**
 * Created by maoqi on 2021/1/12.
 */
class AccountSafeActivity : BaseActivity<MainVM, ActivityAccountSafeBinding>() {

    companion object {
        @JvmStatic
        fun start(context: Context?) {
            context?.also {
                val starter = Intent(it, AccountSafeActivity::class.java)
                if (it !is Activity) {
                    starter.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK)
                }
                it.startActivity(starter)
            }
        }
    }

    override fun setToolbarTitle(): String? {
        return "账号安全"
    }

    override fun initLayout(): Int {
        return R.layout.activity_account_safe
    }

    override fun initData(intent: Intent) {
    }

    override fun initView() {
        tv_account.text = LoginUtils.mUserBean?.account
        btn_change_password.setOnClickListener(object : DoubleClickHelper.OnClickListener() {
            override fun onClicked(view: View?) {
                ChangePasswordActivity.start(this@AccountSafeActivity)
            }
        })
    }

    override fun loadData() {
    }

}